
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>编写高质量可维护的代码：优化逻辑判断 · 记录技术文档内容</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="zhengyuliang">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-sectionx/sectionx.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-toggle-chapters/toggle.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="编写高质量可维护的代码：优雅命名.html" />
    
    
    <link rel="prev" href="编写高质量可维护的代码：一目了然的注释.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        <li class="header">CSS</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../CSS/18种CSS命名和书写规范.html">
            
                <a href="../CSS/18种CSS命名和书写规范.html">
            
                    
                    18种CSS命名和书写规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../CSS/灵活运用CSS开发技巧.html">
            
                <a href="../CSS/灵活运用CSS开发技巧.html">
            
                    
                    灵活运用CSS开发技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../CSS/自适应 flex grid.html">
            
                <a href="../CSS/自适应 flex grid.html">
            
                    
                    自适应 Flex Grid
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">HTML</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../HTML/浏览器里的本地数据库：IndexedDB.html">
            
                <a href="../HTML/浏览器里的本地数据库：IndexedDB.html">
            
                    
                    浏览器里的本地数据库：IndexedDB
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Vue</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../Vue/7个有用的Vue开发技巧.html">
            
                <a href="../Vue/7个有用的Vue开发技巧.html">
            
                    
                    7个有用的Vue开发技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../Vue/Vue this.$router.push、replace、go的区别.html">
            
                <a href="../Vue/Vue this.$router.push、replace、go的区别.html">
            
                    
                    Vue This.$Router.Push、Replace、Go的区别
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="../Vue/Vue 的父组件和子组件生命周期钩子函数执行顺序？.html">
            
                <a href="../Vue/Vue 的父组件和子组件生命周期钩子函数执行顺序？.html">
            
                    
                    Vue 的父组件和子组件生命周期钩子函数执行顺序？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="../Vue/Vue.set和this.$set应用的场景.html">
            
                <a href="../Vue/Vue.set和this.$set应用的场景.html">
            
                    
                    Vue.Set和This.$Set应用的场景
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="../Vue/vue高级技巧.html">
            
                <a href="../Vue/vue高级技巧.html">
            
                    
                    Vue高级技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="../Vue/从 0 开始手把手带你搭建一套规范的 Vue3.x 项目工程环境.html">
            
                <a href="../Vue/从 0 开始手把手带你搭建一套规范的 Vue3.x 项目工程环境.html">
            
                    
                    从 0 开始手把手带你搭建一套规范的 Vue3.X 项目工程环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="../Vue/浅析 vue-router 源码和动态路由权限分配.html">
            
                <a href="../Vue/浅析 vue-router 源码和动态路由权限分配.html">
            
                    
                    浅析 Vue Router 源码和动态路由权限分配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="../Vue/父组件监听到子组件的生命周期.html">
            
                <a href="../Vue/父组件监听到子组件的生命周期.html">
            
                    
                    父组件监听到子组件的生命周期
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="../Vue/理解Vue.mixin，利用Vue.mixin正确的偷懒.html">
            
                <a href="../Vue/理解Vue.mixin，利用Vue.mixin正确的偷懒.html">
            
                    
                    理解Vue.Mixin，利用Vue.Mixin正确的偷懒
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">JavaScript</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="5个技巧让你更好的编写 JavaScript(ES6">
            
                <span>
            
                    
                    5个技巧让你更好的编写 JavaScript(ES6) 中条件语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="5种常见函数的写法和调用方式.html">
            
                <a href="5种常见函数的写法和调用方式.html">
            
                    
                    5种常见函数的写法和调用方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="7道javascript题，让你理解基本的javascript.html">
            
                <a href="7道javascript题，让你理解基本的javascript.html">
            
                    
                    7道Javascript题，让你理解基本的Javascript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="Array.from(">
            
                <span>
            
                    
                    Array.From() 五个超好用的用途
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="ES6汇总资料.html">
            
                <a href="ES6汇总资料.html">
            
                    
                    ES6汇总资料
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="JS开发必须知道的41个技巧.html">
            
                <a href="JS开发必须知道的41个技巧.html">
            
                    
                    JS开发必须知道的41个技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="JavaScript之防抖Debounce和节流Throttle.html">
            
                <a href="JavaScript之防抖Debounce和节流Throttle.html">
            
                    
                    JavaScript之防抖Debounce和节流Throttle
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="JavaScript数组求并集，交集和差集.html">
            
                <a href="JavaScript数组求并集，交集和差集.html">
            
                    
                    JavaScript数组求并集，交集和差集
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="JavaScript的优雅写法.html">
            
                <a href="JavaScript的优雅写法.html">
            
                    
                    JavaScript的优雅写法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.10" data-path="axios知识点.html">
            
                <a href="axios知识点.html">
            
                    
                    Axios知识点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.11" data-path="javascript核心知识.html">
            
                <a href="javascript核心知识.html">
            
                    
                    Javascript核心知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.12" data-path="this、apply、call、bind.html">
            
                <a href="this、apply、call、bind.html">
            
                    
                    This、Apply、Call、Bind
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.13" data-path="前端js常用的60余种工具方法.html">
            
                <a href="前端js常用的60余种工具方法.html">
            
                    
                    前端Js常用的60余种工具方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.14" data-path="前端异常的捕获与处理.html">
            
                <a href="前端异常的捕获与处理.html">
            
                    
                    前端异常的捕获与处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.15" data-path="在 JavaScript 中交换值的 10 种方法.html">
            
                <a href="在 JavaScript 中交换值的 10 种方法.html">
            
                    
                    在 JavaScript 中交换值的 10 种方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.16" data-path="常用的前端JavaScript方法封装.html">
            
                <a href="常用的前端JavaScript方法封装.html">
            
                    
                    常用的前端JavaScript方法封装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.17" data-path="异步神器Async-await介绍与填坑.html">
            
                <a href="异步神器Async-await介绍与填坑.html">
            
                    
                    异步神器Async Await介绍与填坑
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.18" data-path="灵活运用JS开发技巧.html">
            
                <a href="灵活运用JS开发技巧.html">
            
                    
                    灵活运用JS开发技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.19" data-path="编写高质量可维护的代码：一目了然的注释.html">
            
                <a href="编写高质量可维护的代码：一目了然的注释.html">
            
                    
                    编写高质量可维护的代码：一目了然的注释
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="4.20" data-path="编写高质量可维护的代码：优化逻辑判断.html">
            
                <a href="编写高质量可维护的代码：优化逻辑判断.html">
            
                    
                    编写高质量可维护的代码：优化逻辑判断
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.21" data-path="编写高质量可维护的代码：优雅命名.html">
            
                <a href="编写高质量可维护的代码：优雅命名.html">
            
                    
                    编写高质量可维护的代码：优雅命名
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.22" data-path="编写高质量可维护的代码：数据建模.html">
            
                <a href="编写高质量可维护的代码：数据建模.html">
            
                    
                    编写高质量可维护的代码：数据建模
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Life Exp</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../life_exp/告别平庸的15个小方法.html">
            
                <a href="../life_exp/告别平庸的15个小方法.html">
            
                    
                    告别平庸的15个小方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../life_exp/日志记录.html">
            
                <a href="../life_exp/日志记录.html">
            
                    
                    日志记录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="../life_exp/程序员的发展方向.html">
            
                <a href="../life_exp/程序员的发展方向.html">
            
                    
                    程序员的发展方向
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="../message/">
            
                <a href="../message/">
            
                    
                    Message
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Technology</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../technology/WebSocket.html">
            
                <a href="../technology/WebSocket.html">
            
                    
                    WebSocket
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="../technology/npm常用命令大全.html">
            
                <a href="../technology/npm常用命令大全.html">
            
                    
                    Npm常用命令大全
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="../technology/智能照明项目说明.html">
            
                <a href="../technology/智能照明项目说明.html">
            
                    
                    智能照明项目说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="../technology/规范化git的提交信息.html">
            
                <a href="../technology/规范化git的提交信息.html">
            
                    
                    规范化Git的提交信息
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Tutorial</li>
        
        
    
        <li class="chapter " data-level="7.1" data-path="../tutorial/Esmap地图详解.html">
            
                <a href="../tutorial/Esmap地图详解.html">
            
                    
                    Esmap地图详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="../tutorial/npm镜像切换.html">
            
                <a href="../tutorial/npm镜像切换.html">
            
                    
                    Npm镜像切换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="../tutorial/发布npm的教程.html">
            
                <a href="../tutorial/发布npm的教程.html">
            
                    
                    发布Npm的教程
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >编写高质量可维护的代码：优化逻辑判断</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <html><head></head><body><div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#&#x7F16;&#x5199;&#x9AD8;&#x8D28;&#x91CF;&#x53EF;&#x7EF4;&#x62A4;&#x7684;&#x4EE3;&#x7801;&#xFF1A;&#x4F18;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;"><b>1. </b>&#x7F16;&#x5199;&#x9AD8;&#x8D28;&#x91CF;&#x53EF;&#x7EF4;&#x62A4;&#x7684;&#x4EE3;&#x7801;&#xFF1A;&#x4F18;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;</a></li><ul><li><span class="title-icon "></span><a href="#&#x524D;&#x8A00;"><b>1.1. </b>&#x524D;&#x8A00;</a></li><li><span class="title-icon "></span><a href="#javascript-&#x8BED;&#x6CD5;&#x7BC7;"><b>1.2. </b>JavaScript &#x8BED;&#x6CD5;&#x7BC7;</a></li><ul><li><span class="title-icon "></span><a href="#&#x5D4C;&#x5957;&#x5C42;&#x7EA7;&#x4F18;&#x5316;"><b>1.2.1. </b>&#x5D4C;&#x5957;&#x5C42;&#x7EA7;&#x4F18;&#x5316;</a></li><li><span class="title-icon "></span><a href="#&#x591A;&#x6761;&#x4EF6;&#x5206;&#x652F;&#x7684;&#x4F18;&#x5316;&#x5904;&#x7406;"><b>1.2.2. </b>&#x591A;&#x6761;&#x4EF6;&#x5206;&#x652F;&#x7684;&#x4F18;&#x5316;&#x5904;&#x7406;</a></li><li><span class="title-icon "></span><a href="#&#x4F7F;&#x7528;&#x6570;&#x7EC4;&#x65B0;&#x7279;&#x6027;&#x7B80;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;"><b>1.2.3. </b>&#x4F7F;&#x7528;&#x6570;&#x7EC4;&#x65B0;&#x7279;&#x6027;&#x7B80;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;</a></li><li><span class="title-icon "></span><a href="#&#x51FD;&#x6570;&#x9ED8;&#x8BA4;&#x503C;"><b>1.2.4. </b>&#x51FD;&#x6570;&#x9ED8;&#x8BA4;&#x503C;</a></li><li><span class="title-icon "></span><a href="#&#x7B56;&#x7565;&#x6A21;&#x5F0F;&#x4F18;&#x5316;&#x5206;&#x652F;&#x903B;&#x8F91;&#x5904;&#x7406;"><b>1.2.5. </b>&#x7B56;&#x7565;&#x6A21;&#x5F0F;&#x4F18;&#x5316;&#x5206;&#x652F;&#x903B;&#x8F91;&#x5904;&#x7406;</a></li></ul><li><span class="title-icon "></span><a href="#&#x6846;&#x67B6;&#x7BC7;&#x4E4B;-react-jsx-&#x903B;&#x8F91;&#x5224;&#x65AD;&#x4F18;&#x5316;"><b>1.3. </b>&#x6846;&#x67B6;&#x7BC7;&#x4E4B; React JSX &#x903B;&#x8F91;&#x5224;&#x65AD;&#x4F18;&#x5316;</a></li><ul><li><span class="title-icon "></span><a href="#jsx-control-statements"><b>1.3.1. </b>JSX-Control-Statements</a></li></ul><li><span class="title-icon "></span><a href="#&#x603B;&#x7ED3;"><b>1.4. </b>&#x603B;&#x7ED3;</a></li></ul></ul></div><a href="#&#x7F16;&#x5199;&#x9AD8;&#x8D28;&#x91CF;&#x53EF;&#x7EF4;&#x62A4;&#x7684;&#x4EE3;&#x7801;&#xFF1A;&#x4F18;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="&#x7F16;&#x5199;&#x9AD8;&#x8D28;&#x91CF;&#x53EF;&#x7EF4;&#x62A4;&#x7684;&#x4EE3;&#x7801;&#xFF1A;&#x4F18;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;"><a name="&#x7F16;&#x5199;&#x9AD8;&#x8D28;&#x91CF;&#x53EF;&#x7EF4;&#x62A4;&#x7684;&#x4EE3;&#x7801;&#xFF1A;&#x4F18;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;" class="anchor-navigation-ex-anchor" href="#&#x7F16;&#x5199;&#x9AD8;&#x8D28;&#x91CF;&#x53EF;&#x7EF4;&#x62A4;&#x7684;&#x4EE3;&#x7801;&#xFF1A;&#x4F18;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x7F16;&#x5199;&#x9AD8;&#x8D28;&#x91CF;&#x53EF;&#x7EF4;&#x62A4;&#x7684;&#x4EE3;&#x7801;&#xFF1A;&#x4F18;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;</h1>
<p>[TOC]</p>
<h2 id="&#x524D;&#x8A00;"><a name="&#x524D;&#x8A00;" class="anchor-navigation-ex-anchor" href="#&#x524D;&#x8A00;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1. &#x524D;&#x8A00;</h2>
<p>if else&#x3001;switch case &#x662F;&#x65E5;&#x5E38;&#x5F00;&#x53D1;&#x4E2D;&#x6700;&#x5E38;&#x89C1;&#x7684;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x8BED;&#x53E5;&#xFF0C;&#x8FD9;&#x79CD;&#x770B;&#x4F3C;&#x7B80;&#x5355;&#x7684;&#x8BED;&#x53E5;&#xFF0C;&#x5F53;&#x9047;&#x5230;&#x590D;&#x6742;&#x7684;&#x4E1A;&#x52A1;&#x573A;&#x666F;&#x65F6;&#xFF0C;&#x5982;&#x679C;&#x5904;&#x7406;&#x4E0D;&#x5584;&#xFF0C;&#x5C31;&#x4F1A;&#x51FA;&#x73B0;&#x5927;&#x91CF;&#x7684;&#x903B;&#x8F91;&#x5D4C;&#x5957;&#xFF0C;&#x53EF;&#x8BFB;&#x6027;&#x5DEE;&#x5E76;&#x4E14;&#x96BE;&#x4EE5;&#x6269;&#x5C55;&#x3002;</p>
<p>&#x7F16;&#x5199;&#x9AD8;&#x8D28;&#x91CF;&#x53EF;&#x7EF4;&#x62A4;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x6211;&#x4EEC;&#x5148;&#x4ECE;&#x6700;&#x5C0F;&#x5904;&#x5165;&#x624B;&#xFF0C;&#x4E00;&#x8D77;&#x6765;&#x770B;&#x770B;&#x5728;&#x524D;&#x7AEF;&#x5F00;&#x53D1;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x53EF;&#x4EE5;&#x4ECE;&#x54EA;&#x4E9B;&#x65B9;&#x9762;&#x6765;&#x4F18;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;&#xFF1F;</p>
<p>&#x4E0B;&#x9762;&#x6211;&#x4EEC;&#x4F1A;&#x5206;&#x522B;&#x4ECE; JavaScript &#x8BED;&#x6CD5;&#x548C; React JSX &#x8BED;&#x6CD5;&#x4E24;&#x4E2A;&#x65B9;&#x9762;&#x6765;&#x5206;&#x4EAB;&#x4E00;&#x4E9B;&#x4F18;&#x5316;&#x7684;&#x6280;&#x5DE7;&#x3002;</p>
<h2 id="javascript-&#x8BED;&#x6CD5;&#x7BC7;"><a name="javascript-&#x8BED;&#x6CD5;&#x7BC7;" class="anchor-navigation-ex-anchor" href="#javascript-&#x8BED;&#x6CD5;&#x7BC7;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2. JavaScript &#x8BED;&#x6CD5;&#x7BC7;</h2>
<h3 id="&#x5D4C;&#x5957;&#x5C42;&#x7EA7;&#x4F18;&#x5316;"><a name="&#x5D4C;&#x5957;&#x5C42;&#x7EA7;&#x4F18;&#x5316;" class="anchor-navigation-ex-anchor" href="#&#x5D4C;&#x5957;&#x5C42;&#x7EA7;&#x4F18;&#x5316;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.1. &#x5D4C;&#x5957;&#x5C42;&#x7EA7;&#x4F18;&#x5316;</h3>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">supply</span>(<span class="hljs-params">fruit, quantity</span>) </span>{
  <span class="hljs-keyword">const</span> redFruits = [<span class="hljs-string">&apos;apple&apos;</span>, <span class="hljs-string">&apos;strawberry&apos;</span>, <span class="hljs-string">&apos;cherry&apos;</span>, <span class="hljs-string">&apos;cranberries&apos;</span>];
  <span class="hljs-comment">// &#x6761;&#x4EF6; 1: &#x6C34;&#x679C;&#x5B58;&#x5728;</span>
  <span class="hljs-keyword">if</span> (fruit) {
    <span class="hljs-comment">// &#x6761;&#x4EF6; 2: &#x5C5E;&#x4E8E;&#x7EA2;&#x8272;&#x6C34;&#x679C;</span>
    <span class="hljs-keyword">if</span> (redFruits.includes(fruit)) {
      <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x7EA2;&#x8272;&#x6C34;&#x679C;&apos;</span>);
      <span class="hljs-comment">// &#x6761;&#x4EF6; 3: &#x6C34;&#x679C;&#x6570;&#x91CF;&#x5927;&#x4E8E; 10 &#x4E2A;</span>
      <span class="hljs-keyword">if</span> (quantity &gt; <span class="hljs-number">10</span>) {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6570;&#x91CF;&#x5927;&#x4E8E; 10 &#x4E2A;&apos;</span>);
      }
    }
  } <span class="hljs-keyword">else</span> {
    <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Error</span>(<span class="hljs-string">&apos;&#x6CA1;&#x6709;&#x6C34;&#x679C;&#x5566;!&apos;</span>);
  }
}
</code></pre>
<p>&#x5206;&#x6790;&#x4E0A;&#x9762;&#x7684;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#xFF0C;&#x5B58;&#x5728;&#x4E09;&#x5C42; if &#x6761;&#x4EF6;&#x5D4C;&#x5957;&#x3002;</p>
<p>&#x5982;&#x679C;&#x63D0;&#x524D; return &#x6389;&#x65E0;&#x6548;&#x6761;&#x4EF6;&#xFF0C;&#x5C06; if else&#x7684;&#x591A;&#x91CD;&#x5D4C;&#x5957;&#x5C42;&#x6B21;&#x51CF;&#x5C11;&#x5230;&#x4E00;&#x5C42;&#xFF0C;&#x66F4;&#x5BB9;&#x6613;&#x7406;&#x89E3;&#x548C;&#x7EF4;&#x62A4;&#x3002;</p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">supply</span>(<span class="hljs-params">fruit, quantity</span>) </span>{
  <span class="hljs-keyword">const</span> redFruits = [<span class="hljs-string">&apos;apple&apos;</span>, <span class="hljs-string">&apos;strawberry&apos;</span>, <span class="hljs-string">&apos;cherry&apos;</span>, <span class="hljs-string">&apos;cranberries&apos;</span>];
  <span class="hljs-keyword">if</span> (!fruit) <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Error</span>(<span class="hljs-string">&apos;&#x6CA1;&#x6709;&#x6C34;&#x679C;&#x5566;&apos;</span>); <span class="hljs-comment">// &#x6761;&#x4EF6; 1: &#x5F53; fruit &#x65E0;&#x6548;&#x65F6;&#xFF0C;&#x63D0;&#x524D;&#x5904;&#x7406;&#x9519;&#x8BEF;</span>
  <span class="hljs-keyword">if</span> (!redFruits.includes(fruit)) <span class="hljs-keyword">return</span>; <span class="hljs-comment">// &#x6761;&#x4EF6; 2: &#x5F53;&#x4E0D;&#x662F;&#x7EA2;&#x8272;&#x6C34;&#x679C;&#x65F6;&#xFF0C;&#x63D0;&#x524D; return</span>

  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x7EA2;&#x8272;&#x6C34;&#x679C;&apos;</span>);

  <span class="hljs-comment">// &#x6761;&#x4EF6; 3: &#x6C34;&#x679C;&#x6570;&#x91CF;&#x5927;&#x4E8E; 10 &#x4E2A;</span>
  <span class="hljs-keyword">if</span> (quantity &gt; <span class="hljs-number">10</span>) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6570;&#x91CF;&#x5927;&#x4E8E; 10 &#x4E2A;&apos;</span>);
  }
}
</code></pre>
<h3 id="&#x591A;&#x6761;&#x4EF6;&#x5206;&#x652F;&#x7684;&#x4F18;&#x5316;&#x5904;&#x7406;"><a name="&#x591A;&#x6761;&#x4EF6;&#x5206;&#x652F;&#x7684;&#x4F18;&#x5316;&#x5904;&#x7406;" class="anchor-navigation-ex-anchor" href="#&#x591A;&#x6761;&#x4EF6;&#x5206;&#x652F;&#x7684;&#x4F18;&#x5316;&#x5904;&#x7406;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.2. &#x591A;&#x6761;&#x4EF6;&#x5206;&#x652F;&#x7684;&#x4F18;&#x5316;&#x5904;&#x7406;</h3>
<p>&#x5F53;&#x9700;&#x8981;&#x679A;&#x4E3E;&#x503C;&#x5904;&#x7406;&#x4E0D;&#x540C;&#x7684;&#x4E1A;&#x52A1;&#x5206;&#x652F;&#x903B;&#x8F91;&#x65F6;&#xFF0C; &#x7B2C;&#x4E00;&#x53CD;&#x5E94;&#x662F;&#x5199;&#x4E0B; if else &#xFF1F;&#x6211;&#x4EEC;&#x6765;&#x770B;&#x4E00;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">pick</span>(<span class="hljs-params">color</span>) </span>{
  <span class="hljs-comment">// &#x6839;&#x636E;&#x989C;&#x8272;&#x9009;&#x62E9;&#x6C34;&#x679C;</span>
  <span class="hljs-keyword">if</span>(color === <span class="hljs-string">&apos;red&apos;</span>) {
      <span class="hljs-keyword">return</span> [<span class="hljs-string">&apos;apple&apos;</span>, <span class="hljs-string">&apos;strawberry&apos;</span>]; 
  } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (color === <span class="hljs-string">&apos;yellow&apos;</span>) {
      <span class="hljs-keyword">return</span> [<span class="hljs-string">&apos;banana&apos;</span>, <span class="hljs-string">&apos;pineapple&apos;</span>];
  } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (color === <span class="hljs-string">&apos;purple&apos;</span>) {
      <span class="hljs-keyword">return</span> [<span class="hljs-string">&apos;grape&apos;</span>, <span class="hljs-string">&apos;plum&apos;</span>];
  } <span class="hljs-keyword">else</span> {
      <span class="hljs-keyword">return</span> [];
  }
}
</code></pre>
<p>&#x5728;&#x4E0A;&#x9762;&#x7684;&#x5B9E;&#x73B0;&#x4E2D;&#xFF1A;</p>
<ul>
<li>if else &#x5206;&#x652F;&#x592A;&#x591A;</li>
<li>if else &#x66F4;&#x9002;&#x5408;&#x4E8E;&#x6761;&#x4EF6;&#x533A;&#x95F4;&#x5224;&#x65AD;&#xFF0C;&#x800C; switch case &#x66F4;&#x9002;&#x5408;&#x4E8E;&#x5177;&#x4F53;&#x679A;&#x4E3E;&#x503C;&#x7684;&#x5206;&#x652F;&#x5224;&#x65AD;</li>
</ul>
<p>&#x4F7F;&#x7528; switch case &#x4F18;&#x5316;&#x4E0A;&#x9762;&#x7684;&#x4EE3;&#x7801;&#x540E;&#xFF1A;</p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">pick</span>(<span class="hljs-params">color</span>) </span>{
  <span class="hljs-comment">// &#x6839;&#x636E;&#x989C;&#x8272;&#x9009;&#x62E9;&#x6C34;&#x679C;</span>
  <span class="hljs-keyword">switch</span> (color) {
    <span class="hljs-keyword">case</span> <span class="hljs-string">&apos;red&apos;</span>:
      <span class="hljs-keyword">return</span> [<span class="hljs-string">&apos;apple&apos;</span>, <span class="hljs-string">&apos;strawberry&apos;</span>];
    <span class="hljs-keyword">case</span> <span class="hljs-string">&apos;yellow&apos;</span>:
      <span class="hljs-keyword">return</span> [<span class="hljs-string">&apos;banana&apos;</span>, <span class="hljs-string">&apos;pineapple&apos;</span>];
    <span class="hljs-keyword">case</span> <span class="hljs-string">&apos;purple&apos;</span>:
      <span class="hljs-keyword">return</span> [<span class="hljs-string">&apos;grape&apos;</span>, <span class="hljs-string">&apos;plum&apos;</span>];
    <span class="hljs-keyword">default</span>:
      <span class="hljs-keyword">return</span> [];
  }
}
</code></pre>
<p>switch case &#x4F18;&#x5316;&#x4E4B;&#x540E;&#x7684;&#x4EE3;&#x7801;&#x770B;&#x4E0A;&#x53BB;&#x683C;&#x5F0F;&#x6574;&#x9F50;&#xFF0C;&#x601D;&#x8DEF;&#x5F88;&#x6E05;&#x6670;&#xFF0C;&#x4F46;&#x8FD8;&#x662F;&#x5F88;&#x5197;&#x957F;&#x3002;&#x7EE7;&#x7EED;&#x4F18;&#x5316;&#xFF1A;</p>
<ul>
<li>&#x501F;&#x52A9; Object &#x7684; { key: value } &#x7ED3;&#x6784;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5728; Object &#x4E2D;&#x679A;&#x4E3E;&#x6240;&#x6709;&#x7684;&#x60C5;&#x51B5;&#xFF0C;&#x7136;&#x540E;&#x5C06; key &#x4F5C;&#x4E3A;&#x7D22;&#x5F15;&#xFF0C;&#x76F4;&#x63A5;&#x901A;&#x8FC7; Object.key  &#x6216;&#x8005; Object[key] &#x6765;&#x83B7;&#x53D6;&#x5185;&#x5BB9;</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> fruitColor = {
  <span class="hljs-attr">red</span>: [<span class="hljs-string">&apos;apple&apos;</span>, <span class="hljs-string">&apos;strawberry&apos;</span>],
  <span class="hljs-attr">yellow</span>: [<span class="hljs-string">&apos;banana&apos;</span>, <span class="hljs-string">&apos;pineapple&apos;</span>],
  <span class="hljs-attr">purple</span>: [<span class="hljs-string">&apos;grape&apos;</span>, <span class="hljs-string">&apos;plum&apos;</span>],
};
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">pick</span>(<span class="hljs-params">color</span>) </span>{
  <span class="hljs-keyword">return</span> fruitColor[color] || [];
}
</code></pre>
<ul>
<li>&#x4F7F;&#x7528; Map &#x6570;&#x636E;&#x7ED3;&#x6784;&#xFF0C;&#x771F;&#x6B63;&#x7684; (key, value) &#x952E;&#x503C;&#x5BF9;&#x7ED3;&#x6784; &#xFF1B;</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> fruitColor = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>()
.set(<span class="hljs-string">&apos;red&apos;</span>, [<span class="hljs-string">&apos;apple&apos;</span>, <span class="hljs-string">&apos;strawberry&apos;</span>])
.set(<span class="hljs-string">&apos;yellow&apos;</span>, [<span class="hljs-string">&apos;banana&apos;</span>, <span class="hljs-string">&apos;pineapple&apos;</span>])
.set(<span class="hljs-string">&apos;purple&apos;</span>, [<span class="hljs-string">&apos;grape&apos;</span>, <span class="hljs-string">&apos;plum&apos;</span>]);

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">pick</span>(<span class="hljs-params">color</span>) </span>{
  <span class="hljs-keyword">return</span> fruitColor.get(color) || [];
}
</code></pre>
<p>&#x4F18;&#x5316;&#x4E4B;&#x540E;&#xFF0C;&#x4EE3;&#x7801;&#x66F4;&#x7B80;&#x6D01;&#x3001;&#x66F4;&#x5BB9;&#x6613;&#x6269;&#x5C55;&#x3002;</p>
<p>&#x4E3A;&#x4E86;&#x66F4;&#x597D;&#x7684;&#x53EF;&#x8BFB;&#x6027;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x66F4;&#x52A0;&#x8BED;&#x4E49;&#x5316;&#x7684;&#x65B9;&#x5F0F;&#x5B9A;&#x4E49;&#x5BF9;&#x8C61;&#xFF0C;&#x7136;&#x540E;&#x4F7F;&#x7528; Array.filter &#x8FBE;&#x5230;&#x540C;&#x6837;&#x7684;&#x6548;&#x679C;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> fruits = [
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;apple&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;red&apos;</span> }, 
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;strawberry&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;red&apos;</span> }, 
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;banana&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;yellow&apos;</span> }, 
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;pineapple&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;yellow&apos;</span> }, 
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;grape&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;purple&apos;</span> }, 
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;plum&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;purple&apos;</span> }
];

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">pick</span>(<span class="hljs-params">color</span>) </span>{
  <span class="hljs-keyword">return</span> fruits.filter(<span class="hljs-function"><span class="hljs-params">f</span> =&gt;</span> f.color === color);
}
</code></pre>
<h3 id="&#x4F7F;&#x7528;&#x6570;&#x7EC4;&#x65B0;&#x7279;&#x6027;&#x7B80;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;"><a name="&#x4F7F;&#x7528;&#x6570;&#x7EC4;&#x65B0;&#x7279;&#x6027;&#x7B80;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;" class="anchor-navigation-ex-anchor" href="#&#x4F7F;&#x7528;&#x6570;&#x7EC4;&#x65B0;&#x7279;&#x6027;&#x7B80;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.3. &#x4F7F;&#x7528;&#x6570;&#x7EC4;&#x65B0;&#x7279;&#x6027;&#x7B80;&#x5316;&#x903B;&#x8F91;&#x5224;&#x65AD;</h3>
<p>&#x5DE7;&#x5999;&#x7684;&#x5229;&#x7528; ES6 &#x4E2D;&#x63D0;&#x4F9B;&#x7684;&#x6570;&#x7EC4;&#x65B0;&#x7279;&#x6027;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x8BA9;&#x6211;&#x4EEC;&#x66F4;&#x8F7B;&#x677E;&#x7684;&#x5904;&#x7406;&#x903B;&#x8F91;&#x5224;&#x65AD;&#x3002;</p>
<h4 id="&#x591A;&#x6761;&#x4EF6;&#x5224;&#x65AD;"><a name="&#x591A;&#x6761;&#x4EF6;&#x5224;&#x65AD;" class="anchor-navigation-ex-anchor" href="#&#x591A;&#x6761;&#x4EF6;&#x5224;&#x65AD;"><i class="fa fa-link" aria-hidden="true"></i></a><strong>&#x591A;&#x6761;&#x4EF6;&#x5224;&#x65AD;</strong></h4>
<p>&#x7F16;&#x7801;&#x65F6;&#x9047;&#x5230;&#x591A;&#x4E2A;&#x5224;&#x65AD;&#x6761;&#x4EF6;&#x65F6;&#xFF0C;&#x672C;&#x80FD;&#x7684;&#x5199;&#x4E0B;&#x4E0B;&#x9762;&#x7684;&#x4EE3;&#x7801;&#xFF08;&#x5176;&#x5B9E;&#x4E5F;&#x662F;&#x6700;&#x80FD;&#x8868;&#x8FBE;&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x7684;&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#x7F16;&#x7801;&#xFF09;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">judge</span>(<span class="hljs-params">fruit</span>) </span>{
  <span class="hljs-keyword">if</span> (fruit === <span class="hljs-string">&apos;apple&apos;</span> || fruit === <span class="hljs-string">&apos;strawberry&apos;</span> || fruit === <span class="hljs-string">&apos;cherry&apos;</span> || fruit === <span class="hljs-string">&apos;cranberries&apos;</span> ) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;red&apos;</span>);
  }
}
</code></pre>
<p>&#x4F46;&#x662F;&#x5F53; type &#x672A;&#x6765;&#x5230; 10 &#x79CD;&#x751A;&#x81F3;&#x66F4;&#x591A;&#x65F6;&#xFF0C; &#x6211;&#x4EEC;&#x53EA;&#x80FD;&#x7EE7;&#x7EED;&#x6DFB;&#x52A0; || &#x6765;&#x7EF4;&#x62A4;&#x4EE3;&#x7801;&#x4E48; ?</p>
<p>&#x8BD5;&#x8BD5; <strong>Array.includes</strong> ~</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x5C06;&#x5224;&#x65AD;&#x6761;&#x4EF6;&#x62BD;&#x53D6;&#x6210;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;</span>
<span class="hljs-keyword">const</span> redFruits = [<span class="hljs-string">&apos;apple&apos;</span>, <span class="hljs-string">&apos;strawberry&apos;</span>, <span class="hljs-string">&apos;cherry&apos;</span>, <span class="hljs-string">&apos;cranberries&apos;</span>];
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">judge</span>(<span class="hljs-params">fruit</span>) </span>{
  <span class="hljs-keyword">if</span> (redFruits.includes(fruit)) {
      <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;red&apos;</span>);
   }
}
</code></pre>
<h4 id="&#x5224;&#x65AD;&#x6570;&#x7EC4;&#x4E2D;&#x662F;&#x5426;&#x6240;&#x6709;&#x9879;&#x90FD;&#x6EE1;&#x8DB3;&#x67D0;&#x6761;&#x4EF6;"><a name="&#x5224;&#x65AD;&#x6570;&#x7EC4;&#x4E2D;&#x662F;&#x5426;&#x6240;&#x6709;&#x9879;&#x90FD;&#x6EE1;&#x8DB3;&#x67D0;&#x6761;&#x4EF6;" class="anchor-navigation-ex-anchor" href="#&#x5224;&#x65AD;&#x6570;&#x7EC4;&#x4E2D;&#x662F;&#x5426;&#x6240;&#x6709;&#x9879;&#x90FD;&#x6EE1;&#x8DB3;&#x67D0;&#x6761;&#x4EF6;"><i class="fa fa-link" aria-hidden="true"></i></a><strong>&#x5224;&#x65AD;&#x6570;&#x7EC4;&#x4E2D;&#x662F;&#x5426;&#x6240;&#x6709;&#x9879;&#x90FD;&#x6EE1;&#x8DB3;&#x67D0;&#x6761;&#x4EF6;</strong></h4>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> fruits = [
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;apple&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;red&apos;</span> },
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;banana&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;yellow&apos;</span> },
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;grape&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;purple&apos;</span> }
];

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">match</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">let</span> isAllRed = <span class="hljs-literal">true</span>;

  <span class="hljs-comment">// &#x5224;&#x65AD;&#x6761;&#x4EF6;&#xFF1A;&#x6240;&#x6709;&#x7684;&#x6C34;&#x679C;&#x90FD;&#x5FC5;&#x987B;&#x662F;&#x7EA2;&#x8272;</span>
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> f <span class="hljs-keyword">of</span> fruits) {
    <span class="hljs-keyword">if</span> (!isAllRed) <span class="hljs-keyword">break</span>;
    isAllRed = (f.color === <span class="hljs-string">&apos;red&apos;</span>);
  }

  <span class="hljs-built_in">console</span>.log(isAllRed); <span class="hljs-comment">// false</span>
}
</code></pre>
<p>&#x4E0A;&#x9762;&#x7684;&#x5B9E;&#x73B0;&#x4E2D;&#xFF0C;&#x4E3B;&#x8981;&#x662F;&#x4E3A;&#x4E86;&#x5904;&#x7406;&#x6570;&#x7EC4;&#x4E2D;&#x7684;&#x6240;&#x6709;&#x9879;&#x90FD;&#x7B26;&#x5408;&#x6761;&#x4EF6;&#x3002;</p>
<p>&#x4F7F;&#x7528; <strong>Array.every</strong> &#x53EF;&#x4EE5;&#x5F88;&#x5BB9;&#x7684;&#x5B9E;&#x73B0;&#x8FD9;&#x4E2A;&#x903B;&#x8F91;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> fruits = [
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;apple&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;red&apos;</span> },
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;banana&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;yellow&apos;</span> },
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;grape&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;purple&apos;</span> }
];

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">match</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-comment">// &#x6761;&#x4EF6;&#xFF1A;&#x6240;&#x6709;&#x6C34;&#x679C;&#x90FD;&#x5FC5;&#x987B;&#x662F;&#x7EA2;&#x8272;</span>
  <span class="hljs-keyword">const</span> isAllRed = fruits.every(<span class="hljs-function"><span class="hljs-params">f</span> =&gt;</span> f.color === <span class="hljs-string">&apos;red&apos;</span>);
  <span class="hljs-built_in">console</span>.log(isAllRed); <span class="hljs-comment">// false</span>
}
</code></pre>
<h4 id="&#x5224;&#x65AD;&#x6570;&#x7EC4;&#x4E2D;&#x662F;&#x5426;&#x6709;&#x67D0;&#x4E00;&#x9879;&#x6EE1;&#x8DB3;&#x6761;&#x4EF6;"><a name="&#x5224;&#x65AD;&#x6570;&#x7EC4;&#x4E2D;&#x662F;&#x5426;&#x6709;&#x67D0;&#x4E00;&#x9879;&#x6EE1;&#x8DB3;&#x6761;&#x4EF6;" class="anchor-navigation-ex-anchor" href="#&#x5224;&#x65AD;&#x6570;&#x7EC4;&#x4E2D;&#x662F;&#x5426;&#x6709;&#x67D0;&#x4E00;&#x9879;&#x6EE1;&#x8DB3;&#x6761;&#x4EF6;"><i class="fa fa-link" aria-hidden="true"></i></a><strong>&#x5224;&#x65AD;&#x6570;&#x7EC4;&#x4E2D;&#x662F;&#x5426;&#x6709;&#x67D0;&#x4E00;&#x9879;&#x6EE1;&#x8DB3;&#x6761;&#x4EF6;</strong></h4>
<p><strong>Array.some</strong> &#xFF0C;&#x5B83;&#x4E3B;&#x8981;&#x5904;&#x7406;&#x7684;&#x573A;&#x666F;&#x662F;&#x5224;&#x65AD;&#x6570;&#x7EC4;&#x4E2D;&#x662F;&#x5426;&#x6709;&#x4E00;&#x9879;&#x6EE1;&#x8DB3;&#x6761;&#x4EF6;&#x3002;</p>
<p>&#x5982;&#x679C;&#x60F3;&#x77E5;&#x9053;&#x662F;&#x5426;&#x6709;&#x7EA2;&#x8272;&#x6C34;&#x679C;&#xFF0C;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x4F7F;&#x7528; <strong>Array.some</strong> &#x65B9;&#x6CD5;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> fruits = [
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;apple&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;red&apos;</span> },
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;banana&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;yellow&apos;</span> },
  { <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;grape&apos;</span>, <span class="hljs-attr">color</span>: <span class="hljs-string">&apos;purple&apos;</span> }
];

<span class="hljs-comment">// &#x6761;&#x4EF6;&#xFF1A;&#x662F;&#x5426;&#x6709;&#x7EA2;&#x8272;&#x6C34;&#x679C; </span>
<span class="hljs-keyword">const</span> isAnyRed = fruits.some(<span class="hljs-function"><span class="hljs-params">f</span> =&gt;</span> f.color == <span class="hljs-string">&apos;red&apos;</span>);
</code></pre>
<p>&#x8FD8;&#x6709;&#x8BB8;&#x591A;&#x5176;&#x4ED6;&#x6570;&#x7EC4;&#x65B0;&#x7279;&#x6027;&#xFF0C;&#x6BD4;&#x5982; Array.find&#x3001;Array.slice&#x3001;Array.findIndex&#x3001;Array.reduce&#x3001;Array.splice &#x7B49;&#xFF0C;&#x5728;&#x5B9E;&#x9645;&#x573A;&#x666F;&#x4E2D;&#x53EF;&#x4EE5;&#x6839;&#x636E;&#x9700;&#x8981;&#x9009;&#x62E9;&#x4F7F;&#x7528;&#x3002;</p>
<h3 id="&#x51FD;&#x6570;&#x9ED8;&#x8BA4;&#x503C;"><a name="&#x51FD;&#x6570;&#x9ED8;&#x8BA4;&#x503C;" class="anchor-navigation-ex-anchor" href="#&#x51FD;&#x6570;&#x9ED8;&#x8BA4;&#x503C;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.4. &#x51FD;&#x6570;&#x9ED8;&#x8BA4;&#x503C;</h3>
<h4 id="&#x4F7F;&#x7528;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;"><a name="&#x4F7F;&#x7528;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;" class="anchor-navigation-ex-anchor" href="#&#x4F7F;&#x7528;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F7F;&#x7528;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;</h4>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> buyFruit = <span class="hljs-function">(<span class="hljs-params">fruit,amount</span>) =&gt;</span> {
 <span class="hljs-keyword">if</span>(!fruit){
    <span class="hljs-keyword">return</span>
  }
  amount = amount || <span class="hljs-number">1</span>;
  <span class="hljs-built_in">console</span>.log(amount)
}
</code></pre>
<p>&#x6211;&#x4EEC;&#x7ECF;&#x5E38;&#x9700;&#x8981;&#x5904;&#x7406;&#x51FD;&#x6570;&#x5185;&#x90E8;&#x7684;&#x4E00;&#x4E9B;&#x53C2;&#x6570;&#x9ED8;&#x8BA4;&#x503C;&#xFF0C;&#x4E0A;&#x9762;&#x7684;&#x4EE3;&#x7801;&#x5927;&#x5BB6;&#x90FD;&#x4E0D;&#x964C;&#x751F;&#xFF0C;&#x4F7F;&#x7528;&#x51FD;&#x6570;&#x7684;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;&#xFF0C;&#x53EF;&#x4EE5;&#x5F88;&#x597D;&#x7684;&#x5E2E;&#x52A9;&#x5904;&#x7406;&#x8FD9;&#x79CD;&#x573A;&#x666F;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> buyFruit = <span class="hljs-function">(<span class="hljs-params">fruit,amount = <span class="hljs-number">1</span></span>) =&gt;</span> {
 <span class="hljs-keyword">if</span>(!fruit){
    <span class="hljs-keyword">return</span>
  }
  <span class="hljs-built_in">console</span>.log(amount,<span class="hljs-string">&apos;amount&apos;</span>)
}
</code></pre>
<p>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x901A;&#x8FC7; Babel &#x7684;&#x8F6C;&#x8BD1;&#x6765;&#x770B;&#x4E00;&#x4E0B;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;&#x662F;&#x5982;&#x4F55;&#x5B9E;&#x73B0;&#x7684;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-meta">&quot;use strict&quot;</span>
<span class="hljs-keyword">var</span> buyFruit = <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">buyFruit</span>(<span class="hljs-params">fruit</span>) </span>{
    <span class="hljs-keyword">var</span> amount = <span class="hljs-built_in">arguments</span>.length &gt; <span class="hljs-number">1</span> &amp;&amp; <span class="hljs-built_in">arguments</span>[<span class="hljs-number">1</span>] !== <span class="hljs-literal">undefined</span> ? <span class="hljs-built_in">arguments</span>[<span class="hljs-number">1</span>] : <span class="hljs-number">1</span>;
    <span class="hljs-keyword">if</span>(!fruit) {
        <span class="hljs-keyword">return</span>;
    }
    <span class="hljs-built_in">console</span>.lot(amount, <span class="hljs-string">&apos;amount&apos;</span>);
}
</code></pre>
<p>&#x4ECE;&#x4E0A;&#x9762;&#x7684;&#x8F6C;&#x8BD1;&#x7ED3;&#x679C;&#x53EF;&#x4EE5;&#x53D1;&#x73B0;&#xFF0C;&#x53EA;&#x6709;&#x53C2;&#x6570;&#x4E3A; undefined &#x65F6;&#x624D;&#x4F1A;&#x4F7F;&#x7528;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;&#x3002;</p>
<p>&#x6D4B;&#x8BD5;&#x7684;&#x6267;&#x884C;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-js">buyFruit(<span class="hljs-string">&apos;apple&apos;</span>,<span class="hljs-string">&apos;&apos;</span>);  <span class="hljs-comment">// amount</span>
buyFruit(<span class="hljs-string">&apos;apple&apos;</span>,<span class="hljs-literal">null</span>);  <span class="hljs-comment">//null amount</span>
buyFruit(<span class="hljs-string">&apos;apple&apos;</span>);  <span class="hljs-comment">//1 amount</span>
</code></pre>
<p>&#x6240;&#x4EE5;&#x4F7F;&#x7528;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#x9ED8;&#x8BA4;&#x53C2;&#x6570; <code>amount=1</code> &#x5E76;&#x4E0D;&#x7B49;&#x540C;&#x4E8E; <code>amount || 1</code>&#x3002;</p>
<h4 id="&#x4F7F;&#x7528;&#x89E3;&#x6784;&#x4E0E;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;"><a name="&#x4F7F;&#x7528;&#x89E3;&#x6784;&#x4E0E;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;" class="anchor-navigation-ex-anchor" href="#&#x4F7F;&#x7528;&#x89E3;&#x6784;&#x4E0E;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F7F;&#x7528;&#x89E3;&#x6784;&#x4E0E;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;</h4>
<p>&#x5F53;&#x51FD;&#x6570;&#x53C2;&#x6570;&#x662F;&#x5BF9;&#x8C61;&#x65F6;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x89E3;&#x6784;&#x7ED3;&#x5408;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;&#x6765;&#x7B80;&#x5316;&#x903B;&#x8F91;&#x3002;</p>
<p>Before:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> buyFruit = <span class="hljs-function">(<span class="hljs-params">fruit,amount</span>) =&gt;</span> {
  fruit = fruit || {};
  <span class="hljs-keyword">if</span>(!fruit.name || !fruit.price){
      <span class="hljs-keyword">return</span>;
  }
  ...
  amount = amount || <span class="hljs-number">1</span>;
  <span class="hljs-built_in">console</span>.log(amount)
}
</code></pre>
<p>After:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> buyFruit = <span class="hljs-function">(<span class="hljs-params">{ name,price }={},amount</span>) =&gt;</span> {
  <span class="hljs-keyword">if</span>(!name || !prices){
      <span class="hljs-keyword">return</span>;
  }
  <span class="hljs-built_in">console</span>.log(amount)
}
</code></pre>
<h4 id="&#x590D;&#x6742;&#x6570;&#x636E;&#x89E3;&#x6784;"><a name="&#x590D;&#x6742;&#x6570;&#x636E;&#x89E3;&#x6784;" class="anchor-navigation-ex-anchor" href="#&#x590D;&#x6742;&#x6570;&#x636E;&#x89E3;&#x6784;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x590D;&#x6742;&#x6570;&#x636E;&#x89E3;&#x6784;</h4>
<p>&#x5F53;&#x5904;&#x7406;&#x6BD4;&#x8F83;&#x7B80;&#x7684;&#x5BF9;&#x8C61;&#x65F6;&#xFF0C;&#x89E3;&#x6784;&#x4E0E;&#x9ED8;&#x8BA4;&#x53C2;&#x6570;&#x7684;&#x914D;&#x5408;&#x662F;&#x975E;&#x5E38;&#x597D;&#x7684;&#xFF0C;&#x4F46;&#x5728;&#x4E00;&#x4E9B;&#x590D;&#x6742;&#x7684;&#x573A;&#x666F;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x9762;&#x4E34;&#x7684;&#x53EF;&#x80FD;&#x662F;&#x66F4;&#x590D;&#x6742;&#x7684;&#x7ED3;&#x6784;&#x3002;</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> oneComplexObj = {
  <span class="hljs-attr">firstLevel</span>: {
    <span class="hljs-attr">secondLevel</span>: [{
      <span class="hljs-attr">name</span>: <span class="hljs-string">&apos;&apos;</span>,
      <span class="hljs-attr">price</span>: <span class="hljs-string">&apos;&apos;</span>,
    }],
  },
};
</code></pre>
<p>&#x8FD9;&#x4E2A;&#x65F6;&#x5019;&#x5982;&#x679C;&#x518D;&#x901A;&#x8FC7;&#x89E3;&#x6784;&#x53BB;&#x83B7;&#x53D6;&#x5BF9;&#x8C61;&#x91CC;&#x7684;&#x503C;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> {
  <span class="hljs-attr">firstLevel</span>: {
    <span class="hljs-attr">secondLevel</span>: [{ name, price }] = [],
  } = {},
} = oneComplexObj;
</code></pre>
<p>&#x53EF;&#x8BFB;&#x6027;&#x5C31;&#x4F1A;&#x6BD4;&#x8F83;&#x5DEE;&#xFF0C;&#x800C;&#x4E14;&#x9700;&#x8981;&#x8003;&#x8651;&#x591A;&#x5C42;&#x89E3;&#x6784;&#x7684;&#x9ED8;&#x8BA4;&#x503C;&#x4EE5;&#x53CA;&#x6570;&#x636E;&#x5F02;&#x5E38;&#x60C5;&#x51B5;&#x3002;</p>
<p>&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5982;&#x679C;&#x9879;&#x76EE;&#x4E2D;&#x4F7F;&#x7528; lodash &#x5E93;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5176;&#x4E2D;&#x7684; lodash/get &#x65B9;&#x6CD5;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> lodashGet <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;lodash/get&apos;</span>;

<span class="hljs-keyword">const</span> { name,price } = lodashGet(oneComplexObj,<span class="hljs-string">&apos;firstLevel.secondLevel[0]&apos;</span>,{});
</code></pre>
<h3 id="&#x7B56;&#x7565;&#x6A21;&#x5F0F;&#x4F18;&#x5316;&#x5206;&#x652F;&#x903B;&#x8F91;&#x5904;&#x7406;"><a name="&#x7B56;&#x7565;&#x6A21;&#x5F0F;&#x4F18;&#x5316;&#x5206;&#x652F;&#x903B;&#x8F91;&#x5904;&#x7406;" class="anchor-navigation-ex-anchor" href="#&#x7B56;&#x7565;&#x6A21;&#x5F0F;&#x4F18;&#x5316;&#x5206;&#x652F;&#x903B;&#x8F91;&#x5904;&#x7406;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.5. &#x7B56;&#x7565;&#x6A21;&#x5F0F;&#x4F18;&#x5316;&#x5206;&#x652F;&#x903B;&#x8F91;&#x5904;&#x7406;</h3>
<p>&#x7B56;&#x7565;&#x6A21;&#x5F0F;&#xFF1A;&#x5B9A;&#x4E49;&#x4E00;&#x7CFB;&#x5217;&#x7684;&#x7B97;&#x6CD5;&#xFF0C;&#x628A;&#x5B83;&#x4EEC;&#x4E00;&#x4E2A;&#x4E2A;&#x5C01;&#x88C5;&#x8D77;&#x6765;&#xFF0C; &#x5E76;&#x4E14;&#x4F7F;&#x5B83;&#x4EEC;&#x53EF;&#x76F8;&#x4E92;&#x66FF;&#x6362;&#x3002;</p>
<p>&#x4F7F;&#x7528;&#x573A;&#x666F;&#xFF1A;&#x7B56;&#x7565;&#x6A21;&#x5F0F;&#x5C5E;&#x4E8E;&#x5BF9;&#x8C61;&#x884C;&#x4E3A;&#x6A21;&#x5F0F;&#xFF0C;&#x5F53;&#x9047;&#x5230;&#x5177;&#x6709;&#x76F8;&#x540C;&#x884C;&#x4E3A;&#x63A5;&#x53E3;&#x3001;&#x884C;&#x4E3A;&#x5185;&#x90E8;&#x4E0D;&#x540C;&#x903B;&#x8F91;&#x5B9E;&#x73B0;&#x7684;&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;&#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x91C7;&#x7528;&#x7B56;&#x7565;&#x6A21;&#x5F0F;&#xFF1B;&#x6216;&#x8005;&#x662F;&#x4E00;&#x7EC4;&#x5BF9;&#x8C61;&#x53EF;&#x4EE5;&#x6839;&#x636E;&#x9700;&#x8981;&#x52A8;&#x6001;&#x7684;&#x9009;&#x62E9;&#x51E0;&#x79CD;&#x884C;&#x4E3A;&#x4E2D;&#x7684;&#x67D0;&#x4E00;&#x79CD;&#x65F6;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x91C7;&#x7528;&#x7B56;&#x7565;&#x6A21;&#x5F0F;&#xFF1B;&#x8FD9;&#x91CC;&#x4EE5;&#x7B2C;&#x4E8C;&#x79CD;&#x60C5;&#x51B5;&#x4F5C;&#x4E3A;&#x793A;&#x4F8B;&#xFF1A;</p>
<p>Before:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> TYPE = {
  <span class="hljs-attr">JUICE</span>: <span class="hljs-string">&apos;juice&apos;</span>,
  <span class="hljs-attr">SALAD</span>: <span class="hljs-string">&apos;salad&apos;</span>,
  <span class="hljs-attr">JAM</span>: <span class="hljs-string">&apos;jam&apos;</span>,
};
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">enjoy</span>(<span class="hljs-params">{ type = TYPE.JUICE, fruits }</span>) </span>{
  <span class="hljs-keyword">if</span> (!fruits || !fruits.length) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x8BF7;&#x5148;&#x91C7;&#x8D2D;&#x6C34;&#x679C;&#xFF01;&apos;</span>);
    <span class="hljs-keyword">return</span>;
  }
  <span class="hljs-keyword">if</span> (type === TYPE.JUICE) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x69A8;&#x679C;&#x6C41;&#x4E2D;...&apos;</span>);
    <span class="hljs-keyword">return</span> <span class="hljs-string">&apos;&#x679C;&#x6C41;&apos;</span>;
  }
  <span class="hljs-keyword">if</span> (type === TYPE.SALAD) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x505A;&#x6C99;&#x62C9;&#x4E2D;...&apos;</span>);
    <span class="hljs-keyword">return</span> <span class="hljs-string">&apos;&#x62C9;&#x6C99;&apos;</span>;
  }
  <span class="hljs-keyword">if</span> (type === TYPE.JAM) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x505A;&#x679C;&#x9171;&#x4E2D;...&apos;</span>);
    <span class="hljs-keyword">return</span> <span class="hljs-string">&apos;&#x679C;&#x9171;&apos;</span>;
  }
}

enjoy({ <span class="hljs-attr">type</span>: <span class="hljs-string">&apos;juice&apos;</span>, fruits });
</code></pre>
<p>&#x4F7F;&#x7528;&#x601D;&#x8DEF;&#xFF1A;&#x5B9A;&#x4E49;&#x7B56;&#x7565;&#x5BF9;&#x8C61;&#x5C01;&#x88C5;&#x4E0D;&#x540C;&#x884C;&#x4E3A;&#x3001;&#x63D0;&#x4F9B;&#x7B56;&#x7565;&#x9009;&#x62E9;&#x63A5;&#x53E3;&#xFF0C;&#x5728;&#x4E0D;&#x540C;&#x7684;&#x89C4;&#x5219;&#x65F6;&#x8C03;&#x7528;&#x76F8;&#x5E94;&#x7684;&#x884C;&#x4E3A;&#x3002;</p>
<p>After&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> TYPE = {
  <span class="hljs-attr">JUICE</span>: <span class="hljs-string">&apos;juice&apos;</span>,
  <span class="hljs-attr">SALAD</span>: <span class="hljs-string">&apos;salad&apos;</span>,
  <span class="hljs-attr">JAM</span>: <span class="hljs-string">&apos;jam&apos;</span>,
};

<span class="hljs-keyword">const</span> strategies = {
  [TYPE.JUICE](fruits) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x69A8;&#x679C;&#x6C41;&#x4E2D;...&apos;</span>);
    <span class="hljs-keyword">return</span> <span class="hljs-string">&apos;&#x679C;&#x6C41;&apos;</span>;
  },
  [TYPE.SALAD](fruits) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x505A;&#x6C99;&#x62C9;&#x4E2D;...&apos;</span>);
    <span class="hljs-keyword">return</span> <span class="hljs-string">&apos;&#x6C99;&#x62C9;&apos;</span>;
  },
  [TYPE.JAM](fruits) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x505A;&#x679C;&#x9171;&#x4E2D;...&apos;</span>);
    <span class="hljs-keyword">return</span> <span class="hljs-string">&apos;&#x679C;&#x9171;&apos;</span>;
  },
};

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">enjoy</span>(<span class="hljs-params">{ type = TYPE.JUICE, fruits }</span>) </span>{
  <span class="hljs-keyword">if</span> (!type) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x8BF7;&#x76F4;&#x63A5;&#x4EAB;&#x7528;&#xFF01;&apos;</span>);
    <span class="hljs-keyword">return</span>;
  }
  <span class="hljs-keyword">if</span> (!fruits || !fruits.length) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x8BF7;&#x5148;&#x91C7;&#x8D2D;&#x6C34;&#x679C;&#xFF01;&apos;</span>);
    <span class="hljs-keyword">return</span>;
  }
  <span class="hljs-keyword">return</span> strategies[type](fruits);
}

enjoy({ <span class="hljs-attr">type</span>: <span class="hljs-string">&apos;juice&apos;</span>, fruits });
</code></pre>
<h2 id="&#x6846;&#x67B6;&#x7BC7;&#x4E4B;-react-jsx-&#x903B;&#x8F91;&#x5224;&#x65AD;&#x4F18;&#x5316;"><a name="&#x6846;&#x67B6;&#x7BC7;&#x4E4B;-react-jsx-&#x903B;&#x8F91;&#x5224;&#x65AD;&#x4F18;&#x5316;" class="anchor-navigation-ex-anchor" href="#&#x6846;&#x67B6;&#x7BC7;&#x4E4B;-react-jsx-&#x903B;&#x8F91;&#x5224;&#x65AD;&#x4F18;&#x5316;"><i class="fa fa-link" aria-hidden="true"></i></a>1.3. &#x6846;&#x67B6;&#x7BC7;&#x4E4B; React JSX &#x903B;&#x8F91;&#x5224;&#x65AD;&#x4F18;&#x5316;</h2>
<p>JSX &#x662F;&#x4E00;&#x4E2A;&#x770B;&#x8D77;&#x6765;&#x5F88;&#x50CF; XML &#x7684; JavaScript &#x8BED;&#x6CD5;&#x6269;&#x5C55;&#x3002;&#x4E00;&#x822C;&#x5728; React &#x4E2D;&#x4F7F;&#x7528; JSX &#x6765;&#x63CF;&#x8FF0;&#x754C;&#x9762;&#x4FE1;&#x606F;&#xFF0C;ReactDOM.render() &#x5C06; JSX &#x754C;&#x9762;&#x4FE1;&#x606F;&#x6E32;&#x67D3;&#x5230;&#x9875;&#x9762;&#x4E0A;&#x3002;</p>
<p>&#x5728; JSX &#x4E2D;&#x652F;&#x6301; JavaScript &#x8868;&#x8FBE;&#x5F0F;&#xFF0C;&#x65E5;&#x5E38;&#x5F88;&#x5E38;&#x89C1;&#x7684;&#x5FAA;&#x73AF;&#x8F93;&#x51FA;&#x5B50;&#x7EC4;&#x4EF6;&#x3001;&#x4E09;&#x5143;&#x8868;&#x8FBE;&#x5F0F;&#x5224;&#x65AD;&#x3001;&#x518D;&#x590D;&#x6742;&#x4E00;&#x4E9B;&#x76F4;&#x63A5;&#x62BD;&#x8C61;&#x51FA;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x3002;</p>
<p>&#x5728; JSX &#x4E2D;&#x5199;&#x8FD9;&#x4E48;&#x591A;  JavaScript &#x8868;&#x8FBE;&#x5F0F;&#xFF0C;&#x6574;&#x4F53;&#x4EE3;&#x7801;&#x770B;&#x8D77;&#x6765;&#x4F1A;&#x6709;&#x70B9;&#x513F;&#x6742;&#x4E71;&#x3002;&#x8BD5;&#x7740;&#x4F18;&#x5316;&#x4E00;&#x4E0B;&#xFF01;</p>
<h3 id="jsx-control-statements"><a name="jsx-control-statements" class="anchor-navigation-ex-anchor" href="#jsx-control-statements"><i class="fa fa-link" aria-hidden="true"></i></a>1.3.1. JSX-Control-Statements</h3>
<p><a href="https://www.npmjs.com/package/jsx-control-statements" target="_blank">JSX-Control-Statements</a> &#x662F;&#x4E00;&#x4E2A; Babel &#x63D2;&#x4EF6;&#xFF0C;&#x5B83;&#x6269;&#x5C55;&#x4E86; JSX &#x7684;&#x80FD;&#x529B;&#xFF0C;&#x652F;&#x6301;&#x4EE5;&#x6807;&#x7B7E;&#x7684;&#x5F62;&#x5F0F;&#x5904;&#x7406;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x3001;&#x5FAA;&#x73AF;&#x3002;</p>
<h4 id="if-&#x6807;&#x7B7E;"><a name="if-&#x6807;&#x7B7E;" class="anchor-navigation-ex-anchor" href="#if-&#x6807;&#x7B7E;"><i class="fa fa-link" aria-hidden="true"></i></a>If &#x6807;&#x7B7E;</h4>
<p>&#x6807;&#x7B7E;&#x5185;&#x5BB9;&#x53EA;&#x6709;&#x5728; condition &#x4E3A; true &#x65F6;&#x624D;&#x4F1A;&#x6E32;&#x67D3;&#xFF0C;&#x7B49;&#x4EF7;&#x4E8E;&#x6700;&#x7B80;&#x5355;&#x7684;&#x4E09;&#x5143;&#x8868;&#x8FBE;&#x5F0F;&#x3002;</p>
<p>Before:</p>
<pre><code class="lang-javascript">{ condition() ? <span class="hljs-string">&apos;Hello World!&apos;</span> : <span class="hljs-literal">null</span> }
</code></pre>
<p>After:</p>
<pre><code class="lang-javascript">&lt;If condition={ condition() }&gt;Hello World!<span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">If</span>&gt;</span></span>
</code></pre>
<p>&#x6CE8;&#x610F;&#xFF1A; &#x5DF2;&#x88AB;&#x5E9F;&#x5F03;&#xFF0C;&#x590D;&#x6742;&#x7684;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; &#x6807;&#x7B7E;&#x3002;</p>
<h4 id="choose-&#x6807;&#x7B7E;"><a name="choose-&#x6807;&#x7B7E;" class="anchor-navigation-ex-anchor" href="#choose-&#x6807;&#x7B7E;"><i class="fa fa-link" aria-hidden="true"></i></a>Choose &#x6807;&#x7B7E;</h4>
<p>&#x6807;&#x7B7E;&#x4E0B;&#x5305;&#x62EC;&#x81F3;&#x5C11;&#x4E00;&#x4E2A; &#x6807;&#x7B7E;&#x3001;&#x53EF;&#x9009;&#x7684; &#x6807;&#x7B7E;&#x3002;</p>
<p>&#x6807;&#x7B7E;&#x5185;&#x5BB9;&#x53EA;&#x6709;&#x5728; condition &#x4E3A; true &#x65F6;&#x624D;&#x4F1A;&#x6E32;&#x67D3;&#xFF0C;&#x76F8;&#x5F53;&#x4E8E;&#x4E00;&#x4E2A; if &#x6761;&#x4EF6;&#x5224;&#x65AD;&#x5206;&#x652F;&#x3002;</p>
<p>&#x6807;&#x7B7E;&#x5219;&#x76F8;&#x5F53;&#x4E8E;&#x6700;&#x540E;&#x7684; else &#x5206;&#x652F;&#x3002;</p>
<p>Before:</p>
<pre><code class="lang-react">{ test1 ? &lt;span&gt;IfBlock1&lt;/span&gt; : test2 ? &lt;span&gt;IfBlock2&lt;/span&gt; : &lt;span&gt;ElseBlock&lt;/span&gt; }
</code></pre>
<p>After:</p>
<pre><code class="lang-react">&lt;Choose&gt;
  &lt;When condition={ test1 }&gt;
    &lt;span&gt;IfBlock1&lt;/span&gt;
  &lt;/When&gt;
  &lt;When condition={ test2 }&gt;
    &lt;span&gt;IfBlock2&lt;/span&gt;
  &lt;/When&gt;
  &lt;Otherwise&gt;
    &lt;span&gt;ElseBlock&lt;/span&gt;
  &lt;/Otherwise&gt;
&lt;/Choose&gt;
</code></pre>
<h4 id="for-&#x6807;&#x7B7E;"><a name="for-&#x6807;&#x7B7E;" class="anchor-navigation-ex-anchor" href="#for-&#x6807;&#x7B7E;"><i class="fa fa-link" aria-hidden="true"></i></a>For &#x6807;&#x7B7E;</h4>
<p>&#x6807;&#x7B7E;&#x9700;&#x8981;&#x58F0;&#x660E; of&#x3001;each &#x5C5E;&#x6027;&#x3002;</p>
<p>of &#x63A5;&#x6536;&#x7684;&#x662F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x8FED;&#x4EE3;&#x5668;&#x8BBF;&#x95EE;&#x7684;&#x5BF9;&#x8C61;&#x3002;</p>
<p>each &#x4EE3;&#x8868;&#x8FED;&#x4EE3;&#x5668;&#x8BBF;&#x95EE;&#x65F6;&#x7684;&#x5F53;&#x524D;&#x6307;&#x5411;&#x5143;&#x7D20;&#x3002;</p>
<p>Before:</p>
<pre><code class="lang-react">{
  (this.props.items || []).map(item =&gt; {
      return &lt;span key={ item.id }&gt;{ item.title }&lt;/span&gt;
  })
}
</code></pre>
<p>After:</p>
<pre><code class="lang-react">&lt;For each=&quot;item&quot; of={ this.props.items }&gt;
   &lt;span key={ item.id }&gt;{ item.title }&lt;/span&gt;
&lt;/For&gt;
</code></pre>
<p>&#x6CE8;&#x610F;&#xFF1A; &#x6807;&#x7B7E;&#x4E0D;&#x80FD;&#x4F5C;&#x4E3A;&#x6839;&#x5143;&#x7D20;&#x3002;</p>
<h4 id="with-&#x6807;&#x7B7E;"><a name="with-&#x6807;&#x7B7E;" class="anchor-navigation-ex-anchor" href="#with-&#x6807;&#x7B7E;"><i class="fa fa-link" aria-hidden="true"></i></a>With &#x6807;&#x7B7E;</h4>
<p>&#x6807;&#x7B7E;&#x63D0;&#x4F9B;&#x53D8;&#x91CF;&#x4F20;&#x53C2;&#x7684;&#x529F;&#x80FD;&#x3002;</p>
<p>Before:</p>
<pre><code class="lang-jsx">renderFoo = <span class="hljs-function">(<span class="hljs-params">foo</span>) =&gt;</span> {
    <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">span</span>&gt;</span>{ foo }<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span></span>;
}

<span class="hljs-comment">// JSX &#x4E2D;&#x8868;&#x8FBE;&#x5F0F;&#x8C03;&#x7528;</span>
{
    <span class="hljs-keyword">this</span>.renderFoo(<span class="hljs-number">47</span>)
}
</code></pre>
<p>After:</p>
<pre><code class="lang-vue">&lt;With foo={ 47 }&gt;
  &lt;span&gt;{ foo }&lt;/span&gt;
&lt;/With&gt;
</code></pre>
<p>&#x4F7F;&#x7528;&#x8FD9;&#x51E0;&#x79CD;&#x6807;&#x7B7E;&#x4F18;&#x5316;&#x4EE3;&#x7801;&#xFF0C;&#x53EF;&#x4EE5;&#x51CF;&#x5C11;  JSX &#x4E2D;&#x5B58;&#x5728;&#x7684;&#x663E;&#x5F0F; JavaScript &#x8868;&#x8FBE;&#x5F0F;&#xFF0C;&#x4F7F;&#x6211;&#x4EEC;&#x7684;&#x4EE3;&#x7801;&#x770B;&#x4E0A;&#x53BB;&#x66F4;&#x7B80;&#x6D01;&#xFF0C;&#x4F46;&#x662F;&#x8FD9;&#x4E9B;&#x6807;&#x7B7E;&#x5C01;&#x88C5;&#x7684;&#x80FD;&#x529B;&#xFF0C;&#x5728;&#x7F16;&#x8BD1;&#x65F6;&#x9700;&#x8981;&#x8F6C;&#x6362;&#x4E3A;&#x7B49;&#x4EF7;&#x7684; JavaScript &#x8868;&#x8FBE;&#x5F0F;&#x3002;</p>
<p>&#x6CE8;&#x610F;&#xFF1A;&#x5177;&#x4F53; babel-plugin-jsx-control-statements &#x63D2;&#x4EF6;&#x7684;&#x4F7F;&#x7528;&#x89C1;&#x7B2C;&#x4E09;&#x7BC7;&#x53C2;&#x8003;&#x6587;&#x7AE0;&#xFF1B;Vue &#x6846;&#x67B6;&#x5DF2;&#x7ECF;&#x901A;&#x8FC7;&#x6307;&#x4EE4;&#x7684;&#x5F62;&#x5F0F;&#x652F;&#x6301; v-if&#x3001;v-else-if&#x3001;v-else&#x3001;v-show&#x3001;slot &#x7B49;&#x3002;</p>
<h2 id="&#x603B;&#x7ED3;"><a name="&#x603B;&#x7ED3;" class="anchor-navigation-ex-anchor" href="#&#x603B;&#x7ED3;"><i class="fa fa-link" aria-hidden="true"></i></a>1.4. &#x603B;&#x7ED3;</h2>
<p>&#x4EE5;&#x4E0A;&#x6211;&#x4EEC;&#x603B;&#x7ED3;&#x4E86;&#x4E00;&#x4E9B;&#x5E38;&#x89C1;&#x7684;&#x903B;&#x8F91;&#x5224;&#x65AD;&#x4F18;&#x5316;&#x6280;&#x5DE7;&#x3002;&#x5F53;&#x7136;&#xFF0C;&#x7F16;&#x5199;&#x9AD8;&#x8D28;&#x91CF;&#x53EF;&#x7EF4;&#x62A4;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x9664;&#x4E86;&#x903B;&#x8F91;&#x5224;&#x65AD;&#x4F18;&#x5316;&#xFF0C;&#x8FD8;&#x9700;&#x8981;&#x6709;&#x6E05;&#x6670;&#x7684;&#x6CE8;&#x91CA;&#x3001;&#x542B;&#x4E49;&#x660E;&#x786E;&#x7684;&#x53D8;&#x91CF;&#x547D;&#x540D;&#x3001;&#x5408;&#x7406;&#x7684;&#x4EE3;&#x7801;&#x7ED3;&#x6784;&#x62C6;&#x5206;&#x3001;&#x903B;&#x8F91;&#x5206;&#x5C42;&#x89E3;&#x8026;&#x3001;&#x4EE5;&#x53CA;&#x66F4;&#x9AD8;&#x5C42;&#x6B21;&#x7684;&#x8D34;&#x5408;&#x4E1A;&#x52A1;&#x7684;&#x903B;&#x8F91;&#x62BD;&#x8C61;&#x7B49;&#x7B49;&#xFF0C;&#x76F8;&#x4FE1;&#x5404;&#x4F4D;&#x5728;&#x8FD9;&#x65B9;&#x9762;&#x4E5F;&#x6709;&#x81EA;&#x5DF1;&#x7684;&#x4E00;&#x4E9B;&#x5FC3;&#x5F97;&#xFF0C;&#x6B22;&#x8FCE;&#x4E00;&#x8D77;&#x7559;&#x8A00;&#x8BA8;&#x8BBA;~ </p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; zhengyuliang all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x7F16;&#x5199;&#x65F6;&#x95F4;&#xFF1A;
2021-05-19 16:46:30
</span></footer></body></html>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="编写高质量可维护的代码：一目了然的注释.html" class="navigation navigation-prev " aria-label="Previous page: 编写高质量可维护的代码：一目了然的注释">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="编写高质量可维护的代码：优雅命名.html" class="navigation navigation-next " aria-label="Next page: 编写高质量可维护的代码：优雅命名">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"编写高质量可维护的代码：优化逻辑判断","level":"4.20","depth":1,"next":{"title":"编写高质量可维护的代码：优雅命名","level":"4.21","depth":1,"path":"javaScript/编写高质量可维护的代码：优雅命名.md","ref":"javaScript/编写高质量可维护的代码：优雅命名.md","articles":[]},"previous":{"title":"编写高质量可维护的代码：一目了然的注释","level":"4.19","depth":1,"path":"javaScript/编写高质量可维护的代码：一目了然的注释.md","ref":"javaScript/编写高质量可维护的代码：一目了然的注释.md","articles":[]},"dir":"ltr"},"config":{"plugins":["sectionx","splitter","tbfed-pagefooter","toggle-chapters","theme-comscore","-lunr","-search","search-plus","donate","anchor-navigation-ex","expandable-chapters","chapter-fold","expandable-chapters-small","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy zhengyuliang","modify_label":"该文件编写时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"pluginsConfig":{"anchor-navigation-ex":{"showLevel":false,"showGoTop":true,"isRewritePageTitle":true,"isShowTocTitleIcon":true,"tocLevel1Icon":"fa fa-hand-o-right","tocLevel2Icon":"fa fa-hand-o-right","tocLevel3Icon":"fa fa-hand-o-right"}},"livereload":{},"splitter":{},"donate":{"title":"","button":"赏","wechat":"https://gitee.com/htzyl/img_bed/raw/master/pay/weixin-min.jpg","alipay":"https://gitee.com/htzyl/img_bed/raw/master/pay/alipay-min.jpg","wechatText":"微信打赏","alipayText":"支付宝打赏"},"fontsettings":{"theme":"white","family":"sans","size":2},"sectionx":{"tag":"b"},"highlight":{},"anchor-navigation-ex":{"showLevel":true,"associatedWithSummary":true,"mode":"float","showGoTop":true,"printLog":false,"multipleH1":true,"float":{"floatIcon":"fa fa-navicon","showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""}},"theme-comscore":{},"expandable-chapters-small":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"toggle-chapters":{},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"zhengyuliang","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"记录技术文档内容","language":"zh-hans","gitbook":">=3.0.0","description":"记录Gitbook的配置和一些插件的使用","theme-default":{"showLevel":true}},"file":{"path":"javaScript/编写高质量可维护的代码：优化逻辑判断.md","mtime":"2021-05-19T08:46:30.293Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2022-01-06T09:44:01.178Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sectionx/sectionx.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

